<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport"
        content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <link rel="stylesheet" type="text/css" href="../css/aui.2.0.css" />
    <link rel="stylesheet" type="text/css" href="../css/aui-flex.css" />
    <style>
    </style>
</head>
<style>
    .home:before {
        content: url(../image/home.png);
    }

    .refresh:before {
        content: url(../image/refresh.png);
    }

    .company:before {
        content: url(../image/company.png);
    }

    .pa-title {
        font-size: 17px;
        color: black;
        font-weight: bold;
    }

    .pa-title-content {
        font-size: 17px;
        color: black;
    }

    body {
        background-color: #D9D8DB;
    }

    .pa_sg_t {
        background-color: #254060;
        height: 444px;
        color: white;
        overflow: auto;
    }

    .pa_sg {
        margin-top: 2%;
        height: 35px;
        line-height: 35px;
        width: 70%;
        margin-left: 20%;
        text-align: center;
        /* border: 1px solid red; */
    }

    .pa_sg_but {
        height: 60px;
        line-height: 60px;
        float: left;
        width: 150px;
        font-size: 30px;
        color: white;
        margin-left: 50px;
        text-align: center;
        margin-top: 30px;
    }

    .pa_sg input {
        height: 50px;
        min-height: 50px;
    }

    p {
        font-size: 17px;
        color: black;
        font-weight: bold;
        text-align: center;
    }
</style>

<body>
    <header class="aui-bar aui-bar-nav" style="background-color: #D9D8DB">
        <div style="width: 10%;height: 60px;float: left;padding-top: 6px;">
            <a class="aui-pull-left aui-btn ">
                <span class="aui-iconfont company"></span>
            </a>
        </div>
        <div style="width: 10%;height: 60px;float: left;">
            <div style="text-align: left;">
                <span class="pa-title">富晟安创</span>
            </div>
        </div>
        <div style="width: 70%;height: 60px;float: left;">
            <div style="width:18%; float: left; text-align: left;">
                <span class="pa-title-content" id="locationName"></span>
            </div>
            <div style="width:18%; float: left; text-align: left;">
                <span class="pa-title-content" id="workCenterName"></span>
            </div>
            <div style="width:24%; float: left; text-align: left;">
                <span class="pa-title-content" id="workCellName"></span>
            </div>
            <div style="width:40%; float: left; text-align: left;">
                <span class="pa-title-content" id="nowDate"></span>
            </div>
        </div>
        <div style="width: 5%;height: 50px;float: left;">
        </div>
        <div style="width: 5%;height: 50px;float: left;">
            <a class="aui-pull-right aui-btn" onclick="closeWin()">
                <span class="aui-iconfont home"></span>
            </a>
        </div>
    </header>
    <div class="aui-content">
        <div class="aui-flex-col aui-flex-center" style="height: 30px;">
            <div class="aui-flex-item-12">
                <p>上挂</p>
            </div>
        </div>
        <div class="aui-flex-col aui-flex-center">
            <div class="aui-flex-item-12 pa_sg_t">
                <div class="aui-flex-col">
                    <div class="aui-flex-item-12">
                        <div class="aui-flex-col pa_sg">
                            <div class="aui-list-item-inner" style="border: 0;">
                                <div class="aui-list-item-label" style="font-size: 20px;float: left;">
                                    <span>工&nbsp&nbsp单&nbsp号：</span>
                                    <span id="workOrderCode"></span>
                                </div>
                            </div>
                        </div>

                        <div class="aui-flex-col pa_sg" style="display: none;">
                            <div class="aui-list-item-inner" style="border: 0;">
                                <div class="aui-list-item-label" style="font-size: 20px;float: left;">
                                    <span>可上挂数量：</span>
                                    <span id="hangSum"></span>
                                </div>
                            </div>
                        </div>


                        <div class="aui-flex-col pa_sg">
                            <div class="aui-list-item-inner" style="border: 0;">
                                <div class="aui-list-item-label" style="font-size: 20px;float: left;">
                                    <span>计划上挂数量：</span>
                                    <span id="planQty"></span>
                                </div>
                            </div>
                        </div>


                        <div class="aui-flex-col pa_sg">
                            <div class="aui-list-item-inner" style="border: 0;">
                                <div class="aui-list-item-label" style="font-size: 20px;float: left;">
                                    <span>已上挂数量：</span>
                                    <span id="hangUpQty"></span>
                                </div>
                            </div>
                        </div>

                        <div class="aui-flex-col pa_sg">
                            <div class="aui-list-item-inner" style="border: 0;">
                                <div class="aui-list-item-label" style="font-size: 20px;float: left;">
                                    飞&nbsp&nbsp巴&nbsp&nbsp号：</div>
                                <div class="aui-list-item-input"
                                    style="background-color: white;float: left;width: 300px;">
                                    <input type="text" id="fbCode" class="aui-input"
                                        style="height: 35px;min-height: 35px;" onclick="getIdSelector(); "
                                        onfocus="focusFn(this)" />
                                </div>
                            </div>
                        </div>

                        <div class="aui-flex-col pa_sg">
                            <div class="aui-list-item-inner" style="border: 0;">
                                <div class="aui-list-item-label" style="font-size: 20px;float: left;">
                                    条&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp码：</div>
                                <div class="aui-list-item-input"
                                    style="background-color: white;float: left;width: 300px;">
                                    <input type="text" id="containerTm" class="aui-input"
                                        style="height: 35px;min-height: 35px;" onclick="getIdSelector();" />
                                </div>
                            </div>
                        </div>

                        <div class="aui-flex-col pa_sg">
                            <div class="aui-list-item-inner" style="border: 0;">
                                <div class="aui-list-item-label" style="font-size: 20px;float: left;">
                                    <span>物料编码：</span>
                                    <span id="mrlCode"></span>
                                </div>
                            </div>
                        </div>

                        <div class="aui-flex-col pa_sg">
                            <div class="aui-list-item-inner" style="border: 0;">
                                <div class="aui-list-item-label" style="font-size: 20px;float: left;">
                                    <span>规&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp格：</span>
                                    <span id="drawing"></span>
                                </div>
                            </div>
                        </div>

                        <div class="aui-flex-col pa_sg">
                            <div class="aui-list-item-inner" style="border: 0;">
                                <div class="aui-list-item-label" style="font-size: 20px;float: left;">
                                    <span>物料名称：</span>
                                    <span id="mrlName"></span>
                                </div>
                            </div>
                        </div>

                        <div class="aui-flex-col pa_sg" style="display: none;">
                            <div class="aui-list-item-inner" style="border: 0;">
                                <div class="aui-list-item-label" style="font-size: 20px;float: left;">
                                    容器绑定数量：</div>
                                <div class="aui-list-item-input"
                                    style="background-color: white;float: left;width: 300px;">
                                    <input type="text" id="bindQty" class="aui-input" />
                                </div>
                            </div>
                        </div>

                        <div class="aui-flex-col pa_sg">
                            <div class="aui-list-item-inner" style="border: 0;">
                                <div class="aui-list-item-label" style="font-size: 20px;float: left;">
                                    上挂数量：</div>
                                <div class="aui-list-item-input"
                                    style="background-color: white;float: left;width: 300px;">
                                    <input type="number" id="qty" class="aui-input"
                                        style="height: 35px;min-height: 35px;" onclick="getIdSelector();" />
                                </div>
                            </div>
                        </div>

                        <div class="aui-flex-col pa_sg">
                            <div class="pa_sg_but" style="background-color: #4B7902;" id="submitButton"
                                onclick="save()">
                                提交
                            </div>
                            <div class="pa_sg_but" style="background-color: #D9001B;" onclick="cancle()">
                                关闭
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</body>
<script type="text/javascript" src="../script/api.js"></script>
<script type="text/javascript" src="../script/jquery-1.8.2.min.js"></script>
<script type="text/javascript" src="../script/public.js"></script>
<script type="text/javascript" src="../script/clickThrottle.js"></script>
<script type="text/javascript">

    var equipUniqueId = "";
    //光标所在id
    var idSelector = "";

    //初始化
    apiready = function () {
        //获取设备唯一号
        equipUniqueId = localStorage.getItem('equipUniqueId');
        //产线工位信息
        document.getElementById("locationName").innerHTML = api.pageParam.locationName;
        document.getElementById("workCenterName").innerHTML = api.pageParam.workCenterName;
        document.getElementById("workCellName").innerHTML = api.pageParam.workCellName;
        document.getElementById("nowDate").innerHTML = getTimeCommon();
        //当前时间刷新
        window.setInterval("getTime()", 1000);

        document.getElementById("workOrderCode").innerHTML = api.pageParam.workOrderCode;

        api.setFocus({
            inputId: 'fbCode',
            focus: true
        });
        getHangSum(api.pageParam.workOrderCode, false)
    }

    //查询工单号当前剩余上挂数量
    function getHangSum(workOrderCode, isFresh) {
        var un = localStorage.getItem('un');
        var serverUrl = localStorage.getItem('serverUrl');
        var url = serverUrl + "/app/getHangSum";
        var data = {
            values: {
                workOrderCode: workOrderCode,
                un: un,
            }
        };

        var params = new Object();
        params.url = url;
        params.dataType = 'json';
        params.method = 'post';

        ajaxForData(params, data, false, function (ret, err) {
            if (ret) {
                api.hideProgress();
                var data = JSON.stringify(ret);
                var myobj = eval("(" + data + ")");

                //成功
                if (myobj.code == 0) {
                    document.getElementById("hangSum").innerHTML = myobj.hangSum;
                    document.getElementById("hangUpQty").innerHTML = myobj.hangUpQty;
                    document.getElementById("planQty").innerHTML = myobj.planQty;

                    api.setFocus({
                        inputId: isFresh ? 'containerTm' : 'fbCode',
                        focus: true
                    })
                    idSelector = isFresh ? "containerTm" : "fbCode";
                } else {
                    api.toast({
                        msg: myobj.message,
                        duration: 3000
                    });
                }
            } else {
                api.hideProgress();
                alert("网络连接超时!")
            }
        });
    }

    //时间刷新
    function getTime() {
        document.getElementById("nowDate").innerHTML = getTimeCommon();
    }

    // 获取光标所在组件的id
    function getIdSelector() {
        var e = event || window.event;
        var el = e.srcElement || e.target;
        idSelector = el.id;
        $("#" + el.id).select();
    }

    function focusFn(ele) {
        $api.attr(ele, 'readonly', 'readonly');
        setTimeout(() => {
            $api.removeAttr(ele, 'readonly');
        }, 200);
    };

    //防止重复提交标识
    var flag = true
    //保存
    function save() {


        var fbCode = $("#fbCode").val();
        var containerTm = $("#containerTm").val();
        var qty = $("#qty").val();
        var bindQty = $("#bindQty").val();
        //飞巴号非空验证
        if (fbCode == null || fbCode == "" || fbCode == undefined) {
            api.toast({
                msg: '请扫描/录入飞巴号！',
                duration: 3000
            });
            return;
        }

        //容器条码非空验证
        if (containerTm == null || containerTm == "" || containerTm == undefined) {
            api.toast({
                msg: '请扫描/录入容器条码！',
                duration: 3000
            });
            return;
        }

        //上挂数量非空验证
        if (qty == null || qty == "" || qty == undefined) {
            api.toast({
                msg: '上挂数量不能为空！',
                duration: 3000
            });
            return;
        }

        if (parseFloat(qty) <= 0) {
            api.toast({
                msg: '上挂数量必须大于0！',
                duration: 3000
            });
            return;
        }

        //不能大于最大绑定数量
        if (parseFloat(qty) > parseFloat(bindQty)) {
            api.toast({
                msg: '此容器上挂数量最大为【' + bindQty + '】！',
                duration: 3000
            });
            return;
        }
        if (!clickThrottle()) {
            return;
        }
        const submitButton = document.getElementById('submitButton');
        submitButton.style.pointerEvents = "none"; // 禁用提交按钮

        var un = localStorage.getItem('un');
        var serverUrl = localStorage.getItem('serverUrl');
        //先校验先进先出
        var url = serverUrl + "/app/getAssemblyHangUpLotCheck";
        var data = {
            values: {
                workOrderCode: api.pageParam.workOrderCode,
                fbCode: fbCode,
                containerTm: containerTm,
                qty: qty,
                un: un,
            }
        };

        var params = new Object();
        params.url = url;
        params.dataType = 'json';
        params.method = 'post';

        if (!flag) {
            return;
        }
        flag = false;

        api.showProgress({
            title: '保存中...',
        });

        ajaxForData(params, data, false, function (ret, err) {
            if (ret) {
                api.hideProgress();
                var data = JSON.stringify(ret);
                var myobj = eval("(" + data + ")");

                //成功
                if (myobj.code == 0) {
                    var isConfirm = myobj.isConfirm;//是否弹出确认窗口， 1-是
                    if (isConfirm == 1) {
                        api.confirm({
                            title: '物料库转确认',
                            // msg: "容器内以下物料不符合先进先出规则\n"+myobj.confirmMsg+"。"+ "\n是否确认继续库转？",
                            msg: "当前上挂物料不符合先进先出规则，是否强制上挂？",
                            buttons: ['确定', '取消']
                        }, function (ret, err) {
                            var index = ret.buttonIndex;
                            if (index == 1) {
                                //保存
                                var checkxjxc = "1";//库转存储过程不校验先进先出
                                realSave(fbCode, containerTm, qty, un, checkxjxc);
                            } else {
                                submitButton.style.pointerEvents = "auto"; // 启用提交按钮
                                api.hideProgress();
                                $("#containerTm").val("");
                                api.setFocus({
                                    inputId: 'containerTm',
                                    focus: true
                                });
                                idSelector = "containerTm";
                                flag = true;
                                return;
                            }
                        });
                    } else {
                        var checkxjxc = "";
                        realSave(fbCode, containerTm, qty, un, checkxjxc);
                    }

                } else {
                    submitButton.style.pointerEvents = "auto"; // 启用提交按钮
                    api.toast({
                        msg: myobj.message,
                        duration: 3000
                    });
                    flag = true;
                }
            } else {
                submitButton.style.pointerEvents = "auto"; // 启用提交按钮
                api.hideProgress();
                alert("网络连接超时!")
            }
        });



    }

    function realSave(fbCode, containerTm, qty, un, checkxjxc) {
        var containerTmSplit = containerTm.split(",")
        var ctBarRedis = []
        if(containerTmSplit.length > 1){
            ctBarRedis.push(containerTmSplit[9]);
        }else{
            ctBarRedis.push(containerTmSplit);
        }

        var serverUrl = localStorage.getItem('serverUrl');
        var url = serverUrl + "/app/getAssemblyHangUpSave";
        var data = {
            values: {
                workOrderCode: api.pageParam.workOrderCode,
                fbCode: fbCode,
                containerTm: containerTm,
                qty: qty,
                checkxjxc: checkxjxc,
                un: un
                ,ctBarRedis:JSON.stringify(ctBarRedis)
            }
        };
        var params = new Object();
        params.url = url;
        params.dataType = 'json';
        params.method = 'post';

        api.showProgress({
            title: '保存中...',
        });
        ajaxForData(params, data, false, function (ret, err) {
            if (ret) {
                api.hideProgress();
                var data = JSON.stringify(ret);
                var myobj = eval("(" + data + ")");

                //成功
                if (myobj.code == 0) {
                    submitButton.style.pointerEvents = "auto"; // 启用提交按钮
                    api.toast({
                        msg: "保存成功!",
                        duration: 3000
                    });

                    //清空
                    clearForm();
                    getHangSum(api.pageParam.workOrderCode, true);
                } else {
                    submitButton.style.pointerEvents = "auto"; // 启用提交按钮
                    api.toast({
                        msg: myobj.message,
                        duration: 3000
                    });
                }
                flag = true;
            } else {
                submitButton.style.pointerEvents = "auto"; // 启用提交按钮
                api.hideProgress();
                alert("网络连接超时!")
                flag = true;
            }
        });
    }

    //清空表单
    function clearForm() {
        $("#containerTm").val("");
        $("#qty").val("");
        $("#mrlCode").val("");
        $("#mrlName").val("");
        $("#drawing").val("");
    }

    //查询容器当前绑定数量
    function doSearchContainerBindQty(tm) {
        var un = localStorage.getItem('un');
        var serverUrl = localStorage.getItem('serverUrl');
        var url = serverUrl + "/app/getAssemblySearchContainerBind";
        var data = {
            values: {
                containerTm: tm,
                un: un,
            }
        };

        var params = new Object();
        params.url = url;
        params.dataType = 'json';
        params.method = 'post';

        api.showProgress({
            title: '查询中...',
        });

        ajaxForData(params, data, false, function (ret, err) {
            if (ret) {
                api.hideProgress();
                var data = JSON.stringify(ret);
                var myobj = eval("(" + data + ")");

                //成功
                if (myobj.code == 0) {
                    $("#bindQty").val(myobj.qty);
                    $("#qty").val(myobj.qty);
                    $("#mrlCode").html(myobj.mrlCode);
                    $("#mrlName").html(myobj.mrlName);
                    $("#drawing").html(myobj.drawing);
                    api.setFocus({
                        inputId: 'qty',
                        focus: true
                    })

                    idSelector = "qty";

                    // 校验飞巴物料号
                    if( $("#qty").val() > 0){
                        doCheckFbMrlCode();
                    }
                    

                } else {
                    api.toast({
                        msg: myobj.message,
                        duration: 3000
                    });
                }
            } else {
                api.hideProgress();
                alert("网络连接超时!")
            }
        });
    }

    $("#containerTm").on('keypress', function (e) {
        var keycode = e.keyCode;
        var tm = $(this).val();
        if (keycode == '13') {
            if (tm != null && tm != "" && tm != undefined) {
                $("#containerTm").blur();

                var arr = tm.split(",");
                if (arr.length == 10) {
                    //查询箱码当前绑定数量
                    doSearchBoxBindQty(tm);
                }
                else {
                    //查询容器当前绑定数量
                    doSearchContainerBindQty(tm);
                }
            }
        }
    });

    // 校验飞巴物料号
    function doCheckFbMrlCode() {
        var fbCode = $("#fbCode").val();
        var mrlCode = $("#mrlCode").html();
        var un = localStorage.getItem('un');
        var serverUrl = localStorage.getItem('serverUrl');
        var url = serverUrl + "/app/doCheckFbMrlCode";
        var data = {
            values: {
                fbCode: fbCode,
                mrlCode: mrlCode,
                un: un,
            }
        };

        var params = new Object();
        params.url = url;
        params.dataType = 'json';
        params.method = 'post';

        api.showProgress({
            title: '查询中...',
        });

        ajaxForData(params, data, false, function (ret, err) {
            if (ret) {
                api.hideProgress();
                var data = JSON.stringify(ret);
                var myobj = eval("(" + data + ")");

                //成功
                if (myobj.code == 0) {

                    api.setFocus({
                        inputId: 'qty',
                        focus: true
                    })

                    idSelector = "qty";

                } else {
                    $("#containerTm").val("");
                    api.setFocus({
                        inputId: 'containerTm',
                        focus: true
                    });
                    idSelector = "containerTm";

                    api.toast({
                        msg: myobj.message,
                        duration: 9000
                    });
                }
            } else {
                api.hideProgress();
                alert("网络连接超时!")
            }
        });
    }

    //查询箱码当前绑定数量
    function doSearchBoxBindQty(tm) {
        var un = localStorage.getItem('un');
        var serverUrl = localStorage.getItem('serverUrl');
        var url = serverUrl + "/app/getAssemblySearchBoxBind";
        var data = {
            values: {
                containerTm: tm,
                un: un,
            }
        };

        var params = new Object();
        params.url = url;
        params.dataType = 'json';
        params.method = 'post';

        api.showProgress({
            title: '查询中...',
        });

        ajaxForData(params, data, false, function (ret, err) {
            if (ret) {
                api.hideProgress();
                var data = JSON.stringify(ret);
                var myobj = eval("(" + data + ")");

                //成功
                if (myobj.code == 0) {
                    $("#bindQty").val(myobj.qty);
                    $("#qty").val(myobj.qty);
                    $("#mrlCode").html(myobj.mrlCode);
                    $("#mrlName").html(myobj.mrlName);
                    $("#drawing").html(myobj.drawing);

                    api.setFocus({
                        inputId: 'qty',
                        focus: true
                    })

                    idSelector = "qty";

                    // 校验飞巴物料号
                    if( $("#qty").val() > 0){
                        doCheckFbMrlCode();
                    }

                } else {
                    api.toast({
                        msg: myobj.message,
                        duration: 3000
                    });
                }
            } else {
                api.hideProgress();
                alert("网络连接超时!")
            }
        });
    }

    // 飞巴号
    $("#fbCode").on('keypress', function (e) {
        var keycode = e.keyCode;
        var fbCode = $(this).val();
        if (keycode == '13') {
            if (fbCode != null && fbCode != "" && fbCode != undefined) {
                $("#fbCode").blur();

                // 校验飞巴号
                doCheckFbCode(fbCode);
            }
        }
    });

    // 校验飞巴号
    function doCheckFbCode(fbCode) {
        var un = localStorage.getItem('un');
        var serverUrl = localStorage.getItem('serverUrl');
        var url = serverUrl + "/app/getCheckFbCode";
        var data = {
            values: {
                fbCode: fbCode,
                workOrderCode: api.pageParam.workOrderCode,
                un: un,
            }
        };

        var params = new Object();
        params.url = url;
        params.dataType = 'json';
        params.method = 'post';

        api.showProgress({
            title: '查询中...',
        });

        ajaxForData(params, data, false, function (ret, err) {
            if (ret) {
                api.hideProgress();
                var data = JSON.stringify(ret);
                var myobj = eval("(" + data + ")");

                //成功
                if (myobj.code == 0) {

                    // 飞巴上挂时间校验
                    checkDDLocationFb(fbCode);

                } else {
                    $("#fbCode").val("");
                    api.setFocus({
                        inputId: 'fbCode',
                        focus: true
                    });
                    idSelector = "fbCode";

                    api.toast({
                        msg: myobj.message,
                        duration: 9000
                    });
                }
            } else {
                api.hideProgress();
                alert("网络连接超时!")
            }
        });
    }

    // 飞巴上挂时间校验
    function checkDDLocationFb(fbCode) {

        //查询弹框确认标识
        var un = localStorage.getItem('un');
        var serverUrl = localStorage.getItem('serverUrl');
        var url = serverUrl + "/app/checkDDLocationFb";
        var data = {
            values: { ////以表单方式提交参数（JSON对象）
                fbCode: fbCode,// 飞巴号
                un: un
            }
        };
        api.ajax({
            url: url,
            method: 'post',
            dataType: 'json',
            timeout: 300,
            returnAll: false,
            data: data
        }, function (ret, err) {
            if (ret) {
                var data = JSON.stringify(ret);
                var myobj = eval("(" + data + ")");
                //成功
                if (myobj.code == '0') {
                    api.hideProgress();
                    var flag = myobj.flag;

                    console.log('弹出确认框标识：' + flag);

                    //标识为1 弹出确认框
                    if (flag == "1") {

                        api.confirm({
                            title: '飞巴上挂时间校验',
                            msg: myobj.message,
                            buttons: ['确定', '']
                        }, function (ret, err) {
                            var index = ret.buttonIndex;
                            if (index == 1) {

                                console.log('点击了确定按钮');

                                $("#fbCode").val("");

                                api.setFocus({
                                    inputId: 'fbCode',
                                    focus: true
                                })

                            } else {
                                console.log('点击了取消按钮');

                                $("#fbCode").val("");

                                api.setFocus({
                                    inputId: 'fbCode',
                                    focus: true
                                })
                            }
                        });

                        //标识为0 不弹框
                    } else {
                        api.setFocus({
                            inputId: 'containerTm',
                            focus: true
                        })

                        idSelector = "containerTm";
                    }

                } else if (myobj.code == '1') {
                    api.hideProgress();
                    api.toast({
                        msg: myobj.message,
                        duration: 3000
                    });

                    $("#fbCode").val("");

                    api.setFocus({
                        inputId: 'fbCode',
                        focus: true
                    })


                }
            }
        });


    }

    //取消按钮
    function cancle() {
        api.closeWin({});
        api.execScript({
            name: api.pageParam.name,
            script: 'refresh()'
        });
    }

    //返回按钮
    function closeWin() {
        api.closeToWin({ name: api.pageParam.rootName });
        api.execScript({
            name: api.pageParam.rootName,
            script: 'refresh()'
        });
    }
</script>

</html>